package de.kraenksoft.android.cinemaExample.model;

import java.io.IOException;
import java.net.URL;
import java.text.ParseException;

public class WebTheaterFactory {

	public static Theater createTheater() throws IOException, ParseException {
		Theater theater = new Theater();
		URL url;
		int weekCount = 0;
		boolean foundNewScreenings = true;
		while (foundNewScreenings) {
			url = new URL(
					"http://www.universum-filmtheater.de/index.php?id=40&week="
							+ weekCount);
			WebTheaterPageParser pageParser = new WebTheaterPageParser(url,
					theater);
			pageParser.parseMovies();
			foundNewScreenings = pageParser.foundNewScreenings();
			weekCount++;
		}
		return theater;
	}
}
